#ifndef		Object_h
#define		Object_h

#include	<string>
#include	<list>
#include	<vector>
#include	"MaterialLibrary.h"
#include	"CObject.h"

class Config;

struct VertexCoordinates
{
	float x, y, z;
};

struct TextureCoordinates
{
	float u, v;
};

struct Point
{
	int vertex;
	int texture;
};

struct Triangle
{
	Point p1, p2, p3;
};

struct TriangleGroup
{
	std::string name;
	std::string material;
	std::list< Triangle > triangle;
};

class Object
{
public:
	Object(const Config & config);
	~Object();
	void Load(const std::string & file);
	void Cleanup();
	CObject CompiledObject() const;
private:
	void ParseLine(const std::string & line);
	void ParsePoint(Point & pt, const std::string & text);
	void FixIndexes();
private:
	const Config * m_config;
	std::string m_input;
	MaterialLibrary m_matLib;
	std::string m_name;
	std::vector< VertexCoordinates > m_vertCoord;
	std::vector< TextureCoordinates > m_texCoord;
	std::list< TriangleGroup > m_group;
};

#endif	//	Object_h

